#ifndef _NET_EPOLLREACTOR_H_
#define _NET_EPOLLREACTOR_H_

#include <sys/epoll.h>

#include "common/common.h"

#include "ireactor.h"

#include "tickmanager.h"

namespace net {

const uint32_t MAX_EPOLL_SIZE = 1024;

}

namespace net {

class TimerTrigger;

class EpollReactor : public IReactor {
public:
    EpollReactor();
    ~EpollReactor();

public:
    TickManager* GetTickManager();

private:
    void OnEvent(uint32_t count);

private:
    virtual void Stop();
    virtual void Dispatch();
    virtual void RemoveEvent(IEvent* event);
    virtual void AddEvent(IEvent* event, uint32_t type);	

protected:
    int fd_;

    epoll_event events_[MAX_EPOLL_SIZE];

    TickManager tickManager_;
};

}
#endif
